import request from '@/utils/request'
const register = (data: any) => {
  return request({
    url: '/register',
    method: 'POST',
    data,
  })
}
const login = (data: any) => {
  return request({
    url: '/login/password',
    method: 'POST',
    data,
  })
}
const loginCode = (data: any) => {
  return request({
    url: '/login/phone-code',
    method: 'POST',
    data,
  })
}
const logout = (data: any) => {
  return request({
    url: '/ms/login/doSingleLogout',
    method: 'POST',
    data,
  })
}
const getCaptchaImage = (data: { id: string }) => {
  return request({
    url: '/orgLogin/getCaptcha',
    method: 'POST',
    data,
  })
}
const getUserMuenus = () => {
  return request({
    url: '/api/web/getTopMenuList',
    method: 'POST',
  })
}
const refreshToken = (data: { token: string }) => {
  return request({
    url: '/orgLogin/tokenLogin',
    method: 'POST',
    data,
  })
}

const loginApi = {
  register,
  login,
  loginCode,
  logout,
  getCaptchaImage,
  refreshToken,
  getUserMuenus,
}

export default loginApi
